<template>
  <div>
    <h3>请确认订单信息</h3>
    <p>姓名：{{ orderData.userInfo.name }}</p>
    <p>电话：{{ orderData.userInfo.phone }}</p>
    <p>地址：{{ orderData.userInfo.address }}</p>
    <p>服务类型：{{ serviceName }}</p>
    <p>预约时间：{{ orderData.serviceInfo.date }}</p>
    <el-button @click="$emit('prev')">上一步</el-button>
    <el-button type="primary" @click="$emit('submit')">提交订单</el-button>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { getServiceList } from '@/api/service'
const props = defineProps(['orderData'])
const serviceName = ref('')

onMounted(async () => {
  const res = await getServiceList()
  const service = res.data.find(s => s.id === props.orderData.serviceInfo.serviceId)
  serviceName.value = service ? service.name : ''
})
</script> 